package cn.nawang.ebeim.client.bean;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class DataSourceQueue {
  private static BlockingQueue<DataSourceTask> dataSourceQueue =
      new ArrayBlockingQueue<DataSourceTask>(ClientConfiguration.getQueueSize());

  public static BlockingQueue<DataSourceTask> getDataSourceQueue() {
    return dataSourceQueue;
  }

  public static void enqueue(DataSourceTask task) throws InterruptedException {
    dataSourceQueue.put(task);
  }

  public static DataSourceTask dequeue() throws InterruptedException {
    return dataSourceQueue.take();
  }

  public static boolean isEmpty() {
    return dataSourceQueue.isEmpty();
  }
}
